var http = require('../../utils/http.js');
var config = require('../../utils/config.js');
Page({
  data: {
    sts: null,
    recordsXptj: [],
  },

  onLoad: function (option) {
    this.setData({
      sts : option.sts
      })
    console.log(this.data.sts);
    this.handleServe()
  },
  handleServe() {
    if (this.data.sts == 1) {
      http.request({
        url: "/prod/lastedProdPage",
        method: "get",
        data: {
          current: 1,
          size: 10
        },
        callBack: res => {
          this.setData({
          recordsXptj : res.records
            
          })
        }
      });
    } else if(this.data.sts==3){
      http.request({
        url: "/prod/moreBuyProdList",
        method: "get",
        data: {
          current: 1,
          size: 10
        },
        callBack: res => {
          this.setData({
            recordsXptj : res.records
          })
        }
      });
    } else if(this.data.sts==5){
      http.request({
        url: "/p/user/collection/prods",
        method: "get",
        data: {
          current: 1,
          size: 10
        },
        callBack: res => {
          this.setData({
            recordsXptj : res.records
              
            })
        }
      });
    }

  },
  // 跳转详情
  handBan(e) {
    // console.log(e.currentTarget.dataset.item);
    if (e.currentTarget.dataset.item.prodId) {
        wx.navigateTo({
            url: `/pages/prod/prod?prodid=${e.currentTarget.dataset.item.prodId}`
        })
    }
},

})